#include <iostream>
#include "server.hpp"


int main()
{

    Buffer buf;
    for(int i=0;i<300;i++){
        std::string str="hello world"+std::to_string(i)+"\n";
        buf.writeAsString(str);
    }
    while (buf.readable_size() > 0)
    {
        std::cout << buf.readLine() << std::endl;
        LOG(INFO,"read line");
    }
    
    std::string line=buf.readAsString(buf.readable_size());
    std::cout <<"line:"<< line << std::endl;


    /*
    Buffer buf;
    std::string str = "Hello, world!";
    buf.writeAsString(str);
    Buffer buf2;
    buf2.writeAsBuffer(buf);

    std::cout <<"buf2:"<< buf2.readable_size() << std::endl;
    std::cout << "buf:" << buf.readable_size() << std::endl;
    std::string str2 = buf2.readAsString(str.size());
    std::cout << str2 << std::endl;
    std::cout << buf.readable_size() << std::endl;
    std::cout << buf2.readable_size() << std::endl;
    */
    return 0;
}